FROM python:3.7.5

ENV PATH "$PATH:/usr/src/resource/node-v12.16.3-linux-x64/bin"

ARG RESOURCE_BASE_URL="https://zhuyun-static-files-production.oss-cn-hangzhou.aliyuncs.com/dataflux-func/resource"
ARG NODE_PKG="node-v12.16.3-linux-x64.tar.gz"


USER root

RUN mkdir -p /data

RUN echo "deb http://mirrors.aliyun.com/debian/ buster main non-free contrib \
        \ndeb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib \
        \ndeb http://mirrors.aliyun.com/debian-security buster/updates main \
        \ndeb-src http://mirrors.aliyun.com/debian-security buster/updates main \
        \ndeb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib \
        \ndeb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib \
        \ndeb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib \
        \ndeb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" \
    > /etc/apt/sources.list && \
    apt-get update && \
    apt-get install -y wget curl telnet unzip default-mysql-client

WORKDIR /usr/src/resource
RUN wget -q $RESOURCE_BASE_URL/$NODE_PKG && \
        tar -xf $NODE_PKG


WORKDIR /usr/src/base
COPY package.json package-lock.json server.js run-app.sh ./
RUN npm install --registry=http://registry.npm.taobao.org --disturl=http://npm.taobao.org/dist
